Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

isbinaryfile

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isbinaryfile

Detects if a file is binary in Node.js. Similar to Perl's -B.

  • 5.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5M
decreased by-21.39%
Maintainers
1
Weekly downloads
 
Created

What is isbinaryfile?

The isbinaryfile npm package is used to determine if a file is binary or text. This can be useful in various scenarios such as file processing, content analysis, and data validation.

What are isbinaryfile's main functionalities?

Check if a file is binary by file path

This feature allows you to check if a file is binary by providing the file path. The function returns a promise that resolves to a boolean indicating whether the file is binary.

const { isBinaryFile } = require('isbinaryfile');

(async () => {
  const result = await isBinaryFile('path/to/file');
  console.log(result); // true or false
})();

Check if a file is binary by buffer

This feature allows you to check if a file is binary by providing a buffer. The function returns a promise that resolves to a boolean indicating whether the file is binary.

const { isBinaryFile } = require('isbinaryfile');
const fs = require('fs');

(async () => {
  const buffer = fs.readFileSync('path/to/file');
  const result = await isBinaryFile(buffer);
  console.log(result); // true or false
})();

Other packages similar to isbinaryfile

Keywords

FAQs

Package last updated on 23 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc